Skip to content

Conversation

@simonrosenberg
Copy link
Collaborator

Summary

  • set Laminar trace session/evaluation IDs from UNIQUE_EVAL_NAME (CI eval id)
  • attach benchmark and model metadata to Laminar trace/eval payloads

Testing

  • uv run pre-commit run --files benchmarks/utils/laminar.py benchmarks/utils/evaluation.py

simonrosenberg and others added 4 commits January 26, 2026 16:18
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
@simonrosenberg simonrosenberg marked this pull request as draft January 26, 2026 17:54
Co-authored-by: openhands <openhands@all-hands.dev>
@simonrosenberg
Copy link
Collaborator Author

@OpenHands /codereview-roasted
Read this PR diff
the goal is to set Laminar trace session/evaluation IDs from UNIQUE_EVAL_NAME (CI eval id) and attach benchmark and model metadata to Laminar trace/eval payloads

We should not add any useless complexity or useless code to the code
use pip to install laminar locally and inspect their code to understand how it works
and make sure this PR adds clean minimal code to reach the goal stated above

@openhands-ai
Copy link

openhands-ai bot commented Jan 27, 2026

I'm on it! simonrosenberg can track my progress at all-hands.dev

@openhands-ai
Copy link

openhands-ai bot commented Jan 27, 2026

Code Review Summary for PR #362

I reviewed the PR diff and inspected the Laminar SDK source code to understand how it works. Here's my assessment:

🔴 Verdict: Needs Rework

The PR has fundamental issues - the core mechanism is broken because it attempts to set trace session IDs and metadata at a point where no trace/span exists.

Critical Issues Found:

  1. Dead Code - set_trace_session_id calls (3 locations):

    • laminar.py:61-62 - Called right after Laminar.initialize() with no active span
    • laminar.py:99-103 - Called again in create_evaluation() with no active span
    • evaluation.py:267-268 - set_trace_metadata() called with no active span

    The Laminar SDK's set_trace_session_id() and set_trace_metadata() methods require an active span to work. Without one, they log a warning and return immediately, doing nothing.

  2. Redundant metadata handling: The code adds run_id to metadata, but the evaluation name is already set to run_id - storing the same value twice serves no purpose.

  3. Unnecessary complexity: create_evaluation() grew from a simple wrapper to a confused mess with multiple if run_id: blocks.

Recommended Fix:

The session ID and metadata should be set inside create_evaluation_datapoint() where Laminar.start_active_span() creates an actual span - that's the only place in this code where a span exists:

def create_evaluation_datapoint(
    self,
    eval_id: UUID | None,
    data: Any,
    metadata: dict[str, Any],
    index: int,
    session_id: str | None = None,
    trace_metadata: dict[str, Any] | None = None,
) -> tuple[UUID | None, str | None]:
    # ...
    eval_span = Laminar.start_active_span("Evaluation", span_type="EVALUATION")
    # NOW there's an active span - set session ID and metadata here
    if session_id:
        Laminar.set_trace_session_id(session_id)
    if trace_metadata:
        Laminar.set_trace_metadata(trace_metadata)
    # ...

Then remove all the useless set_trace_session_id and set_trace_metadata calls from initialize() and create_evaluation().


No code changes were made - this was a code review only as requested. The PR author should address these issues before merging.

View full conversation

Co-authored-by: openhands <openhands@all-hands.dev>
@simonrosenberg simonrosenberg force-pushed the laminar-ci-run-metadata branch from 3b25a95 to 140c173 Compare January 27, 2026 10:59
@simonrosenberg simonrosenberg marked this pull request as ready for review January 27, 2026 13:29
@simonrosenberg simonrosenberg self-assigned this Jan 27, 2026
Copy link
Collaborator

@juanmichelini juanmichelini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@simonrosenberg simonrosenberg merged commit be177b1 into main Jan 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants